########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
#    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    * See the License for the specific language governing permissions and
#    * limitations under the License.

FILTERS_INCLUDE = ['created_at', 'id', 'visibility', 'value', 'created_by',
                   'is_system_filter']
INCLUDES = {
    'tenants': ['name', 'rabbitmq_password'],
    'users': ['username', 'role', 'tenant_roles', 'first_login_at',
              'last_login_at', 'created_at'],
    'user_groups': ['name', 'ldap_dn', 'tenants', 'role'],
    'sites': ['name', 'location', 'visibility', 'created_by', 'created_at'],
    'plugins': ['id', 'title', 'visibility', 'uploaded_at', 'created_by'],
    'secrets': ['key', 'value', 'visibility', 'is_hidden_value', 'encrypted',
                'tenant_name', 'creator', 'created_at'],
    'blueprints': ['id', 'visibility', 'labels', 'created_at', 'created_by',
                   'state', 'main_file_name', 'plan', 'description', 'error',
                   'error_traceback', 'is_hidden', 'requirements'],
    'deployments': ['id', 'blueprint_id', 'inputs', 'visibility', 'labels',
                    'display_name', 'runtime_only_evaluation', 'created_by',
                    'created_at', 'workflows', 'groups', 'policy_triggers',
                    'policy_types', 'outputs', 'capabilities', 'description',
                    'scaling_groups', 'resource_tags', 'deployment_status',
                    'installation_status', 'sub_services_status',
                    'sub_environments_status', 'sub_services_count',
                    'sub_environments_count'],
    'inter_deployment_dependencies': ['id', 'visibility', 'created_at',
                                      'created_by', 'dependency_creator',
                                      'target_deployment_func',
                                      'source_deployment_id',
                                      'target_deployment_id',
                                      'external_source', 'external_target'],
    'nodes': ['id', 'host_id', 'plugins', 'plugins_to_install', 'properties',
              'max_number_of_instances', 'min_number_of_instances',
              'planned_number_of_instances', 'deploy_number_of_instances',
              'relationships', 'operations', 'type', 'type_hierarchy',
              'visibility', 'created_by', 'number_of_instances'],
    'node_instances': ['id', 'runtime_properties', 'state', 'relationships',
                       'system_properties', 'scaling_groups', 'host_id',
                       'index', 'visibility', 'node_id', 'created_by',
                       'has_configuration_drift',
                       'is_status_check_ok', 'created_by'],
    'agents': ['id', 'node_instance_id', 'state', 'created_at', 'created_by',
               'rabbitmq_password', 'rabbitmq_username', 'rabbitmq_exchange',
               'version', 'system', 'install_method', 'ip', 'visibility'],
    'deployment_groups': ['id', 'visibility', 'description', 'labels',
                          'default_blueprint_id', 'default_inputs',
                          'deployment_ids', 'created_by', 'created_at',
                          'creation_counter'],
    'executions': ['deployment_id', 'workflow_id', 'parameters', 'is_dry_run',
                   'allow_custom_parameters', 'status', 'created_by',
                   'created_at', 'id', 'started_at', 'ended_at', 'error'],
    'events': ['timestamp', 'reported_timestamp', 'blueprint_id',
               'deployment_id', 'deployment_display_name', 'workflow_id',
               'message', 'error_causes', 'event_type', 'operation',
               'source_id', 'target_id', 'node_instance_id',
               'type', 'logger', 'level', 'manager_name', 'agent_name'],
    'execution_groups': ['id', 'created_at', 'workflow_id', 'execution_ids',
                         'concurrency', 'deployment_group_id', 'created_by'],
    'deployment_updates': ['id', 'deployment_id', 'new_blueprint_id', 'state',
                           'new_inputs', 'created_at', 'created_by',
                           'execution_id', 'old_blueprint_id',
                           'runtime_only_evaluation', 'deployment_plan',
                           'deployment_update_node_instances',
                           'visibility', 'steps',
                           'central_plugins_to_uninstall',
                           'central_plugins_to_install', 'old_inputs',
                           'deployment_update_nodes', 'modified_entity_ids'],
    'execution_schedules': ['id', 'rule', 'deployment_id', 'workflow_id',
                            'created_at', 'since', 'until', 'stop_on_fail',
                            'parameters', 'execution_arguments', 'slip',
                            'enabled', 'created_by'],
    'plugins_update': ['id', 'state', 'forced', 'all_tenants',
                       'blueprint_id', 'execution_id', 'created_by',
                       'created_at', 'deployments_to_update',
                       'deployments_per_tenant', 'temp_blueprint_id'],
    'blueprints_filters': FILTERS_INCLUDE,
    'deployments_filters': FILTERS_INCLUDE,
    'tasks_graphs': ['created_at', 'execution_id', 'name', 'id'],
    'operations': ['agent_name', 'created_at', 'dependencies', 'id',
                   'manager_name', 'name', 'parameters', 'state', 'type',
                   'tasks_graph_id'],
    'secrets_providers': ['created_at', 'name', 'visibility', 'type',
                          'connection_parameters', 'created_by',
                          'created_at'],
    'composer': ['blueprints', 'configuration', 'favorites'],
    'stage': ['blueprint-layouts', 'configuration', 'page-groups', 'pages',
              'templates', 'ua', 'widgets'],
}
